<?php
	if (!isset($_SESSION['username'])) {
		if (!isset($_POST['username'])) {
			include("flatshare_php/login_form.php");
		}
		else {
			echo "<p id=\"loginFailed\">Invalid username/password.</p>";
			include("flatshare_php/login_form.php");
		}
	}
	else {
		echo "<p>Logged in as ".$_SESSION['username'].".</p>";
		echo "<p><a href=\"?logout=y\"><img src=\"images/LogOut.png\" width=\"100\" height=\"25\" alt=\"Log Out\" /></a></p>";
		
		$invites = checkInvites($_SESSION['username']);
		
		if ($invites) {
			echo "<p>You have " . $invites . " pending invites. Click <a href=\"group.php?group_invites\">here</a> to view the invitations.</p>";
		}
		
		$notifications = checkNotifications($_SESSION['username']);
		
		if ($notifications) {
			echo '<p>You have ' . $notifications . ' pending notifications. Click <a href="group.php?viewnotifications">here</a> to view your notifications.</p>';
		}
	}
?>